import { GaRegExp, ruleInject, ruleInjectable } from "../InjectionRule";
import { blankRemove } from "../methods/blank-remove";

@ruleInjectable()
export default class classRule extends GaRegExp {

	@ruleInject() private annotationRule!: GaRegExp;

	@ruleInject() private variableNameRule!: GaRegExp;

	@ruleInject() private genericRule!: GaRegExp;

	@ruleInject() private exportValueRule!: GaRegExp;

	public RuleInit() {
		this.ParseRule([
			this.Supply("CLASS"),
			"(", this.annotationRule, ")",
			"class", "(&", "\\s", blankRemove, this.variableNameRule, ")?", blankRemove, this.genericRule, "\\{", blankRemove,
			"(", this.Supply("CLASS_ATTR"), "(", this.annotationRule, ")", "(&(!", "public|private|protected", ")", "\\s", blankRemove, ")?", this.exportValueRule, blankRemove, ")*",
			"\\}",
		]);
	}

}
